package com.abe.jmcl.android.menu.fragment;

import android.widget.GridView;

import com.abe.jmcl.R;
import com.abe.jmcl.adapter.MenuCommonAdapter;
import com.abe.jmcl.entity.BaseMenuEntity;
import com.abeframe.core.base.MVPBaseFragment;
import com.abeframe.core.base.MVPBasePresenter;
import com.abeframe.core.libs.adapter.CommonData;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class MenuFrameFragment extends MVPBaseFragment {
    @Override
    protected MVPBasePresenter createPresenter() {
        return null;
    }

    @Override
    protected void init() {

    }

    @Override
    protected int getLayoutResId() {
        return R.layout.fragment_menu_frame;
    }

    @Override
    protected void initDatas() {
        datas = new ArrayList<>();
        for (int i = 0; i < menus.length; i++) {
            datas.add(new CommonData(MenuCommonAdapter.TYPE_MENU_FRAME, new BaseMenuEntity(menus[i], menuIcons[i])));
        }
        adapter = new MenuCommonAdapter(getThisContext(), datas);
        gridView.setAdapter(adapter);
    }

    public MenuFrameFragment() {
    }

    public static MenuFrameFragment newInstance() {
        return new MenuFrameFragment();
    }

    @BindView(R.id.item_grid_common)
    GridView gridView;

    private MenuCommonAdapter adapter;
    private List<CommonData> datas;

    private String[] menus = {"菜单1"};
    private int[] menuIcons = {R.drawable.icon_menu_common};
}